#include "IntegerChromosome.h"

IntegerChromosome::IntegerChromosome() :
        VectorChromosome<int>()
{
}

IntegerChromosome::IntegerChromosome(int size) :
        VectorChromosome<int>(size)
{
}

IntegerChromosome::IntegerChromosome(int size, int min, int max) :
        VectorChromosome<int>(size, min, max)
{
}

IntegerChromosome::IntegerChromosome(int min, int max) :
        VectorChromosome<int>(min, max)
{
}

IntegerChromosome::IntegerChromosome(const IntegerChromosome &other) :
        VectorChromosome<int>(other)
{
}

IntegerChromosome& IntegerChromosome::operator=(const IntegerChromosome& other)
{
    this->VectorChromosome<int>::operator=(other);

    return *this;
}

int IntegerChromosome::getRandomValue() const
{
    double temp = minValue + (qrand() % (maxValue - minValue + 1));
    return temp;
}

QString IntegerChromosome::toString() const
{
    QString out("");

    for(int i=0;i<geneArray.size() - 1;++i)
        out += QString::number(geneArray[i]) + ",";
    out += QString::number(geneArray.last());

    return out;
}

Chromosome* IntegerChromosome::duplicate() const
{
    return new IntegerChromosome(*this);
}
